<?php
class kst_import_data_pdt_model extends MY_Model {
	var $model = 'kst_import_data_pdt';
	
	function GetJSON()
	{
		$ls_sql	= "	SELECT	*
					FROM	kst_kemasan 
					WHERE	(UPPER(kemasan) LIKE '%".strtoupper(post('keyword'))."%'
							OR UPPER(isi) LIKE '%".strtoupper(post('keyword'))."%')
					ORDER BY ".(post('sort')=='' ? 'kemasan' : post('sort'))." ".(post('order')=='' ? 'asc' : post('order'));	
		return json_encode( $this->paging($ls_sql) );
	}
		
	// function Add($arr_data){
	// 	$this->db->insert('kst_kemasan', $arr_data);
	// }
	
	// function Update($arr_data, $arr_rule){
	// 	$this->db->update('kst_kemasan', $arr_data, $arr_rule);
	// }
	
	// function GetSingle($as_id_kemasan){
	// 	$result = $this->db->get_where('kst_kemasan', array('id_kemasan' => $as_id_kemasan));
	// 	if($result->num_rows() == 1){
	// 		return $result->row_array();
	// 	}else{
	// 		return NULL;
	// 	}
	// }
	
	// function GetSingleView($as_id_kemasan)
	// {
	// 	$result = $this->db->get_where('kst_kemasan', array('id_kemasan' => $as_id_kemasan));
	// 	if($result->num_rows() == 1){
	// 		return $result->row_array();
	// 	}else{
	// 		return NULL;
	// 	}
	// }

	// function DeleteSingle($arr_rule)
	// {
	// 	try {
	// 		if(	intval($this->get_data("SELECT COUNT(1) FROM kst_kemasan WHERE id_kemasan = '".$arr_rule['id_kemasan']."'"))<=0)
	// 		{
	// 			return $this->error_delete.' [id: '.$arr_rule['id_kemasan']."]<br />";
	// 		}else{
	// 			$this->db->delete('kst_kemasan', array('id_kemasan' => $arr_rule['id_kemasan']));
	// 			return '';
	// 		}
	// 	} catch(Exception $e) {
	// 		return $e->getMessage();
	// 	}
	// }
}
?>